# @shuaige : 陈世玉
# @name :10解析淘票票.py
# @time :2024/12/4 22:17
import requests
import json
import jsonpath
url ='https://dianying.taobao.com/cityAction.json?activityId&_ksTS=1733321995937_108&jsoncallback=jsonp109&action=cityAction&n_s=new&event_submit_doGetAllRegion=true'
headers={
    'cookie':'t=cd7c722bb5da0a0966f217d088677458; cookie2=196859377b4057d7eb52e4be047e2e22; v=0; _tb_token_=30935e3b3bd4; xlly_s=1; isg=BPr6EL0LSSVFlMVJUNaXUOVZSyAcq36FljNKTQTz-w1Y95ox7DnulYMJR4Mr5_Yd',
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0',
    'referer':'https://dianying.taobao.com/'
}
response=requests.get(url,headers=headers)
response.encoding='utf-8'
# print(response.text)
content=response.text
content=content.replace('jsonp109(','').replace(');','')
# print(content)
with open('10淘票票.json','r',encoding='utf-8') as f:
    obj=json.load(f)
    city_list=jsonpath.jsonpath(obj,'$..regionName')
    print(city_list)